<template>
  <div class="swiper-container" id="floor1Swiper" ref="mySwiper">
    <div class="swiper-wrapper">
      <div class="swiper-slide" v-for="swiperItem in value" :key="swiperItem.id">
        <img height="100%" width="100%" :src="swiperItem.imgUrl">
      </div>
    </div>
    <!-- 如果需要分页器 -->
    <div class="swiper-pagination"></div>
    <!-- 如果需要导航按钮 -->
    <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>
  </div>
</template>


<script>
import Swiper from 'swiper';

export default {
  name: 'carousel',
  props: ['value'],
  watch: {
    value: {
      handler(n, o) {
        this.$nextTick(() => {
          new Swiper(this.$refs.mySwiper, {
            loop: true,
            navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev",
            }
          });
        })
      },
      immediate: true,
      deep: true
    }
  }
}

</script>

<style scoped>
</style>